@extends('layouts.app')

@section('content')
    <div class="content">
        <div class="header">
            <ul class="breadcrumb">
                <li><i class="fa fa-fw fa-cog"></i>内保管理</li>
                <li>安全隐患查询</li>
            </ul>
        </div>
        <div class="main-content">
            <div class="btn-toolbar list-toolbar">
                <form class="form-inline  text-center center-block" style="margin-top:0px;" method="post">
                    <input type="hidden" name="_token" value="{{ csrf_token() }}">
                    <span class="btn-default" type="button">单位名</span>
                    <input class="input-xlarge form-control" placeholder="单位名" type="text" name="name" value="@if($_POST){{$_POST['name']}}@endif">
                    <span class="btn-default" type="button">所属组织</span>
                    <select class="input-xlarge form-control" name="org_id">
                        <option value="">请选择所属组织</option>
                        @foreach($org as $k=>$v)
                            <option value="{{$v->id}}" @if($_POST && $_POST['org_id'] == $v->id) selected @endif>{{$v->name}}</option>
                        @endforeach
                    </select>
                    <button class="btn btn-primary" type="submit"><i class="fa fa-search"></i>搜索</button>
                </form>
                <div class="form-all">
                    <table class="table table-form table-striped table-bordered table-condensed">
                        <thead>
                        <tr>
                            <th width="80">序号</th>
                            <th>单位名</th>
                            <th>所属组织</th>
                            <th>单位类型</th>
                            <th>操作</th>
                        </tr>
                        </thead>
                        <tbody>
                        @foreach ($res as $key=>$re)
                            <tr>
                                <td>{{ $key+1 }}</td>
                                <td>{{ $re->name }}</td>
                                <td>@if($re->area_id == '' )暂无@else{{ getValue($re->area_id,'org','id','name') }}@endif</td>
                                <td>
                                    @if($re->type == 1)党政机关
                                    @elseif($re->type == 2)卫生系统
                                    @elseif($re->type == 3)高校
                                    @elseif($re->type == 4)中小学幼儿园
                                    @elseif($re->type == 5)大型商场超市、金银珠宝店
                                    @elseif($re->type == 6)银行、金融机构
                                    @elseif($re->type == 7)加油（气）站
                                    @elseif($re->type == 8)其他单位
                                    @elseif(!$re->type)暂无
                                    @endif
                                </td>
                                <td>
                                    <a href="{{url('admin/safe/aqyh_list',$re->id)}}" class="btn btn-default dropdown-toggle">查看安全隐患</a>
                                </td>
                            </tr>
                        @endforeach
                        </tbody>
                    </table>
                </div>
                <span>共{{$count}}条数据</span>
                <ul class="pagination pull-right">
                    {{ $res->render() }}
                </ul>
            </div>
        </div>
    </div>

    <script type="text/javascript">
        function check() {
            $('#search_form').submit();
        }

        $('.zhuxiao').click(function(){
            var i=window.confirm("确认注销该单位？");
            if(i==0){
                return false;
            }
        });
        $('.huifu').click(function(){
            var i=window.confirm("确认恢复该单位？");
            if(i==0){
                return false;
            }
        });
        $('.swzd').click(function(){
            var i=window.confirm("确认设置为重点单位？");
            if(i==0){
                return false;
            }
        });
        $('.qxzd').click(function(){
            var i=window.confirm("确认取消重点单位？");
            if(i==0){
                return false;
            }
        });
        $('.renling').click(function(){
            var i=window.confirm("确认认领该单位？");
            if(i==0){
                return false;
            }
        });
        $('.shifang').click(function(){
            var i=window.confirm("确认释放该单位？");
            if(i==0){
                return false;
            }
        });
    </script>
@stop

